<?php

namespace Application\Model\Entity;

class Menu {
	/**
	 * @var int
	 */
	protected $id;
	
	/**
	 * @var string
	 */
	protected $name;

	/**
	 * @var string
	 */
	protected $label;

	/**
	 * @var string
	 */
	protected $route;
	
	/**
	 * @var int
	 */
	protected $order;

	/**
	 * @var int
	 */
	protected $status;

	/**
	 * @var datetime
	 */
	protected $dateAdded;

	/**
	 * @author Tiago Peres da Silva <psilva.dev@gmail.com>
	 * @param array $data
	 */
	public function __construct($data = null) {
		if(is_array($data)) {
			$this->exchangeArray($data);
		}
	}

	/**
	 * The new array to exchange with the current object.
	 * @author Tiago Peres da Silva <psilva.dev@gmail.com>
	 * @param array $data
	 */
	public function exchangeArray(array $data) {
		$this->id			= (isset($data['menu_id']))		? $data['menu_id']		: null;
		$this->name			= (isset($data['name']))		? $data['name']			: null;
		$this->label		= (isset($data['label']))		? $data['label']		: null;
		$this->order		= (isset($data['order']))		? $data['order']		: null;
		$this->status		= (isset($data['status']))		? $data['status']		: null;
		$this->dateAdded	= (isset($data['date_added']))	? $data['date_added']	: null;
	}

	/**
	 * A copy of the array, or array of public properties if ArrayIterator refers to an object.
	 * @author Tiago Peres da Silva <psilva.dev@gmail.com>
	 * @return array
	 */
	public function getArrayCopy() {
		return get_object_vars($this);
	}

	/**
	 * @param int $id
	 * @return $this
	 */
	public function setId($id) {
		$this->id = $id;
		return $this;
	}

	/**
	 * @return int
	 */
	public function getId() {
		return $this->id;
	}
	
	/**
	 * @param string $name
	 * @return $this
	 */
	public function setName($name) {
		$this->name = $name;
		return $this;
	}

	/**
	 * @return string
	 */
	public function getName() {
		return $this->name;
	}
	
	/**
	 * @param string $label
	 * @return $this
	 */
	public function setLabel($label) {
		$this->label = $label;
		return $this;
	}

	/**
	 * @return string
	 */
	public function getLabel() {
		return $this->label;
	}
	
	/**
	 * @param string $route
	 * @return $this
	 */
	public function setRoute($route) {
		$this->route = $route;
		return $this;
	}

	/**
	 * @return string
	 */
	public function getRoute() {
		return $this->route;
	}
	
	/**
	 * @param int $order
	 * @return $this
	 */
	public function setOrder($order) {
		$this->order = $order;
		return $this;
	}

	/**
	 * @return int
	 */
	public function getOrder() {
		return $this->order;
	}

	/**
	 * @param int $status
	 * @return $this
	 */
	public function setStatus($status) {
		$this->status = $status;
		return $this;
	}

	/**
	 * @return int
	 */
	public function getStatus() {
		return $this->status;
	}

	/**
	 * @param datetime $dateAdded
	 * @return $this
	 */
	public function setDateAdded($dateAdded) {
		$this->dateAdded = $dateAdded;
		return $this;
	}

	/**
	 * @return datetime
	 */
	public function getDateAdded() {
		return $this->dateAdded;
	}
}